{	Problem: http://codeforces.ru/problemset/problem/85/B
	Verdict: Accepted
}
uses
        SysUtils, Math;

var
        k,t:array[0..4] of int64;
        a,l:array[0..100010] of int64;
        i,n:longint;
        ans:int64;

procedure go(v:longint);

var
        i:longint;
        
begin
for i:=1 to n do begin 
        if i>k[v] then l[i]:=max(l[i],l[i-k[v]]);
        inc(l[i],t[v]);
end;
end;
                
begin 
read(k[1],k[2],k[3],t[1],t[2],t[3],n);
for i:=1 to n do begin
        read(a[i]);
        l[i]:=a[i];
end;
for i:=1 to 3 do
        go(i);
ans:=0;
for i:=1 to n do
        ans:=max(ans,l[i]-a[i]);
write(ans);
end.